home *** CD-ROM | disk | FTP | other *** search
- ;==========================================================================;
- ; Service handlers ;
- ; ;
- ; Copyright 1983 by William E. Westfield. All rights reserved. ;
- ; Copyright 1986, 1987, 1988 by H. Roy Engehausen. All rights reserved. ;
- ; This software may be freely distributed and used, but it may not ;
- ; under any circumstances be sold by anyone other than the author. ;
- ; It may be distributed by a commercial company as long as it is ;
- ; for no cost. ;
- ; ;
- ; Permission is explicity granted to use this code as a model for ;
- ; other programs requiring interupt driven serial I/O as long as they ;
- ; carry this copyright notice. ;
- ;==========================================================================;
-
- rsint:
-
- ASSUME DS: NOTHING ; Don't use DS
- ASSUME ES: NOTHING ; Don't use ES
- ASSUME SS: NOTHING ; Don't use SS
-
- ;--------------------------------------------------------------------------;
- ; Not disabled please ;
- ;--------------------------------------------------------------------------;
-
- STI ;
-
- ;--------------------------------------------------------------------------;
- ; See if this is our vector? ;
- ;--------------------------------------------------------------------------;
-
- PUSH SI ; Save SI over our loop
- MOV SI,OFFSET com_start ;
-
- com_srch_loop: ;
-
- CMP DL,CS:comnumber[SI] ; Is this our port?
- JE rsint_ours ; Yes...
-
- MOV SI,CS:com_next[SI] ; Increment to next com port block
-
- CMP SI,0 ; Anything left to be checked?
- JNE com_srch_loop ; Yep....
-
- ;--------------------------------------------------------------------------;
- ; Not us.. Pop things out and call regular handler ;
- ;--------------------------------------------------------------------------;
-
- not_us:
-
- POP SI ; Pop SI
- JMP CS:DWORD PTR old_bios_vector
-
- ;--------------------------------------------------------------------------;
- ; SI now contains the pointer to the com block... See what ;
- ; the user has requested and we may or may not do it....... ;
- ;--------------------------------------------------------------------------;
-
- rsint_ours:
-
- PUSH DX ; We need the DX register
- PUSH CX ; We need the CX register
- PUSH BX ; We need the BX register
- PUSH ES ; We need the ES register
- PUSH DS ; We need the DS register
- PUSH DI ; We need the DI register
-
- MOV BX,CS ; Transfer CS to DS
- MOV DS,BX ; via BX
- ASSUME DS: everything ; We now have DS working
-
- ;--------------------------------------------------------------------------;
- ; Stack offsets to registers ;
- ;--------------------------------------------------------------------------;
-
- stack_di = 0
- stack_ds = 2
- stack_es = 4
- stack_bx = 6
- stack_cx = 8
- stack_dx = 10
-
- ;--------------------------------------------------------------------------;
- ; If an 8250, QuadPort, or 4 Async Port, use the 8250 routines ;
- ;--------------------------------------------------------------------------;
-
- IF present_8250
-
- CMP chip[SI],chip_8250
- JE rsint_8250
- CMP chip[SI],chip_qrqp
- JE rsint_8250
- CMP chip[SI],chip_4apc
- JE rsint_8250
-
- JMP rsint_not_8250
- rsint_8250:
-
- INCLUDE 8250SVC.ASM; ; 8250 services
-
- rsint_not_8250:
-
- ENDIF
-
- ;--------------------------------------------------------------------------;
- ; If an 8530 then use 8530 routines! ;
- ;--------------------------------------------------------------------------;
-
- IF present_8530
-
- CMP chip[SI],chip_8530
- JE rsint_8530
- JMP rsint_not_8530
-
- rsint_8530:
-
- INCLUDE 8530SVC.ASM; ; 8530 services
-
- rsint_not_8530:
-
- ENDIF
-
- ;--------------------------------------------------------------------------;
- ; Interrupt exit -- Used when interrupt is serviced ;
- ;--------------------------------------------------------------------------;
-
- rsint_exit:
-
- ASSUME DS: NOTHING ; DS now invalid
-
- POP DI ; Restore registers
- POP DS ;
- POP ES ;
- POP BX ;
- POP CX ;
- POP DX ;
- POP SI ;
- IRET ; and leave
-
- ;--------------------------------------------------------------------------;
- ; Interrupt exit -- Used when interrupt is not serviced to call next in ;
- ; the chain. ;
- ;--------------------------------------------------------------------------;
-
- rsint_exit_not_us:
-
- ASSUME DS: NOTHING ; DS now invalid
-
- POP DS ; Restore registers
- POP ES ;
- POP BX ;
- POP CX ;
- POP DX ;
- POP SI ;
- JMP CS:DWORD PTR old_bios_vector ; This way out